FreeCntr32
 
Component FreeCntr32
Time measurement counting periodic interrupt ticks in 32-bit SW counter (suitable for longer time periods).
Component Level: High
Typical Usage:
(Examples of a typical usage of the component in user code. For more information please see the page Component Code Typical Usage.)

Required component name is "FC321".

(1)
The following code sample measures the time of the for-cycle in microseconds (requires floating point library):

 MAIN.C

void main(void)
{
  unsigned int i, time;
  float one_loop_us;
  
  FC321_Reset(); /* reset the counter */
  
  for (i = 0; i < 60000; ++i); /* for-cycle */
  
  /* get measured time of whole for-cycle */
  if(FC321_GetTimeUS(&time) == ERR_OK) {
  
    /* average time of one loop */
    one_loop_us = time / 60000.0; 
  }  
}